import {fetchCategory,fetchSlides,fetchList} from '@/api/home.js'
export default{
    namespaced: true,
    state:{
        category:[],
        slides:[],
        currentLession:-1// 默认拿全部数据
    },
    getters:{

    },
    mutations:{
        setCategory(state,result){
            state.category = result;
        },
        setSlides(state,result){
            state.slides = result;
        },
        setLession(state,result){
            state.currentLession = result;
        }
    },
    actions:{
        async setCategory({commit}){
            let result = await fetchCategory();
            commit('setCategory',result);
        },
        async setSlides({commit}){
            let result = await fetchSlides();
            commit('setSlides',result);
        },

    }
    
}